<?php
namespace app\common\model;

use think\Model;

class Gameulog extends Model
{
    protected $connection = 'db_config_aiqi';
    protected $login_tmie = 'login_tmie';
    
    public static function getplayerinfo($id)
	{
	    $user = Player::where('id', $id)->find();
		return $user;
	}
    public static function addLog($data){
        self::create( self::setData($data));
    }

    public static function setData($data){
        return [
            'uid' => !empty($data['uid']) ? $data['uid'] : 0,
            'cid' => !empty($data['cid']) ? $data['cid'] : 0,
            'gid' => !empty($data['gid']) ? $data['gid'] : 0,
            'sid' => !empty($data['sid']) ? $data['sid'] : 0,
            'client' => !empty($data['client']) ? $data['client'] : 0,
            'login_time' => time(),
            'login_ip' => request()->ip()
        ];
    }
}